Option Strict Off
Option Explicit On
Namespace BMLERP
	Friend Class frmSell
		Inherits System.Windows.Forms.Form

		Private Sub Check_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Check.CheckStateChanged
			Fdate.Focus()
		End Sub

		Private Sub cmdexit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdexit.Click
			Me.Close()
		End Sub
		Private Sub cmdPrint_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdPrint.Click
			If Option1.Checked = True Then
				If (Dcust.CtlText = "") Or (Fdate.Text = "") Or (Tdate.Text = "") Then
					MsgBox("No value in Text box! Please enter value", MsgBoxStyle.Critical, "Warning")
					Exit Sub
				Else
					Cre.ReportFileName = DDAN & "\Sell_item.rpt"
					Cre.RetrieveStoredProcParams()
					Cre.set_StoredProcParam(0, VB6.Format(Fdate.Text, "mm/dd/yyyy"))
					Cre.set_StoredProcParam(1, VB6.Format(Tdate.Text, "mm/dd/yyyy"))
					Cre.set_StoredProcParam(2, CustNo.Text)
					Cre.Destination = Crystal.DestinationConstants.crptToWindow
					Cre.Action = 1
				End If
			End If
			If Option2.Checked = True Then
				If (Fdate.Text = "") Or (Tdate.Text = "") Then
					MsgBox("No value in Text box! Please enter value", MsgBoxStyle.Critical, "Warning")
					Exit Sub
				Else
					If Check.CheckState = System.Windows.Forms.CheckState.Checked Then
						Cre.ReportFileName = DDAN & "\ReportSellforallcustdetail.rpt"
						Cre.RetrieveStoredProcParams()
						Cre.set_StoredProcParam(0, VB6.Format(Fdate.Text, "mm/dd/yyyy"))
						Cre.set_StoredProcParam(1, VB6.Format(Tdate.Text, "mm/dd/yyyy"))
						Cre.Destination = Crystal.DestinationConstants.crptToWindow
						Cre.Action = 1
					Else
						Cre.ReportFileName = DDAN & "\ReportSellforLocalCustomer.rpt"
						Cre.RetrieveStoredProcParams()
						Cre.set_StoredProcParam(0, VB6.Format(Fdate.Text, "mm/dd/yyyy"))
						Cre.set_StoredProcParam(1, VB6.Format(Tdate.Text, "mm/dd/yyyy"))
						Cre.Destination = Crystal.DestinationConstants.crptToWindow
						Cre.Action = 1
					End If
				End If
			End If
			If Option3.Checked = True Then
				If (Fdate.Text = "") Or (Tdate.Text = "") Then
					MsgBox("No value in Text box! Please enter value", MsgBoxStyle.Critical, "Warning")
					Exit Sub
				Else
					Cre.ReportFileName = DDAN & "\ReportSellforForeignCustomer.rpt"
					Cre.RetrieveStoredProcParams()
					Cre.set_StoredProcParam(0, VB6.Format(Fdate.Text, "mm/dd/yyyy"))
					Cre.set_StoredProcParam(1, VB6.Format(Tdate.Text, "mm/dd/yyyy"))
					Cre.Destination = Crystal.DestinationConstants.crptToWindow
					Cre.Action = 1
				End If
			End If
		End Sub

		Private Sub Dcust_Change(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Dcust.Change
			If Dcust.CtlText <> "" Then
				CustNo.Text = Dcust.BoundText
				Fdate.Focus()
			End If
		End Sub


		Private Sub FD_Click()
			custno.Text = ""
			Dcust.CtlText = ""
			Fdate.Text = ""
			Tdate.Text = ""
		End Sub

		Private Sub Fdate_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles Fdate.KeyPress
			Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
			If KeyAscii = 13 Then
				Tdate.Focus()
			End If
			eventArgs.KeyChar = Chr(KeyAscii)
			If KeyAscii = 0 Then
				eventArgs.Handled = True
			End If
		End Sub

		Private Sub frmSell_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
			Adodc1.ConnectionString = ConnectString
			Adodc1.CommandTimeout = 10
			Adodc1.CommandType = ADODB.CommandTypeEnum.adCmdText
			Adodc1.RecordSource = "select CMCNO,CMCNO +'  :  '+ CMNME as CMNME FROM RCM"
			Dcust.RowSource = Adodc1
			Option1.Checked = False
			Option2.Checked = False
			Option3.Checked = False
			Check.Visible = False
			Check.CheckState = System.Windows.Forms.CheckState.Unchecked
		End Sub
		Private Sub Option1_CheckedChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Option1.CheckedChanged
			If eventSender.Checked Then
				Option1.Checked = True
				Option2.Checked = False
				Option3.Checked = False
				Dcust.Enabled = True
				Dcust.CtlText = ""
				Check.Visible = False
			End If
		End Sub
		Private Sub Option2_CheckedChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Option2.CheckedChanged
			If eventSender.Checked Then
				Dcust.Enabled = False
				CustNo.Text = ""
				Dcust.CtlText = ""
				Fdate.Focus()
				Option1.Checked = False
				Option2.Checked = True
				Option3.Checked = False
				Check.Visible = True
			End If
		End Sub


		Private Sub Option3_CheckedChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Option3.CheckedChanged
			If eventSender.Checked Then
				Dcust.Enabled = False
				CustNo.Text = ""
				Dcust.CtlText = ""
				Dcust.Enabled = False
				Fdate.Focus()
				Option1.Checked = False
				Option2.Checked = False
				Option3.Checked = True
				Check.Visible = False
			End If
		End Sub

		Private Sub Tdate_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles Tdate.KeyPress
			Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
			If KeyAscii = 13 Then
				cmdPrint.Focus()
			End If
			eventArgs.KeyChar = Chr(KeyAscii)
			If KeyAscii = 0 Then
				eventArgs.Handled = True
			End If
		End Sub
	End Class
End Namespace